<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
</head>
<body>
    <input id='put1' type="text"><br>
    <input id='put2' type="text"><br>
    <input id='put3'type="text"><br>
    <input id='put4'type="text"><br>
    <input id='put5'type="text"><br>
    <button>计算</button>
</body>
    <script>
        var btn=document.querySelector('button')
        btn.addEventListener('click',function(){
            // var p1=document.getElementById('put1').value
            // var p2=document.getElementById('put2').value
            // var p3=document.getElementById('put1').value
            // var p1=document.getElementById('put1').value
            // var p1=document.getElementById('put1').value
            
            var  puts=document.querySelectorAll('input')
            var sum=0
            for(var i=0;i<puts.length;i++){
                sum+=parseInt(puts[i].value)
                 
            }
            alert('总和='+sum)
        })
    </script>
</html>